package com.ruoyi.app.controller;
import com.ruoyi.app.domain.ArticleInfo;
import com.ruoyi.app.domain.TripInfo;
import com.ruoyi.app.service.PermissionService;
import com.ruoyi.common.utils.PermissionAnnotate;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/*
@description:
@ClassName PermissionController
@author chen
@create 2025-03-14 15:21
@Version 1.0
*/
@Slf4j
@RestController
@RequestMapping("app")
@AllArgsConstructor
public class PermissionController extends BaseController
{

    final PermissionService permissionService;

    /*
     * @==============History===============<br/>;
     * @Description //   用户发表文章
     * @Date 2025/3/14
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    @PermissionAnnotate(operateType = "用户模块", operateExplain = "用户发表文章", sourceType = "controller")
    @PostMapping(value = "/insertArticleInfo",produces = "application/json;charset=utf-8")
    public AjaxResult insertArticleInfo(@RequestBody ArticleInfo articleInfo)
    {
        return permissionService.insertArticleInfo(articleInfo);
    }



    /*
     * @==============History===============<br/>;
     * @Description //   用户更新文章
     * @Date 2025/3/18
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    @PermissionAnnotate(operateType = "用户模块", operateExplain = "用户更新文章", sourceType = "controller")
    @PostMapping(value = "/updateArticleInfo",produces = "application/json;charset=utf-8")
    public AjaxResult updateArticleInfo(@RequestBody ArticleInfo articleInfo)
    {
        return permissionService.updateArticleInfo(articleInfo);
    }


    /*
     * @==============History===============<br/>
     * @Description //   用户删除文章
     * @Date 2025-3-18 19:28
     * @Author < a href="15991488967@163.com">chen</ a>
     * @return com.ruoyi.framework.web.domain.AjaxResult
     */
    @PermissionAnnotate(operateType = "用户模块", operateExplain = "用户删除文章", sourceType = "controller")
    @DeleteMapping(value = "/deleteArticleInfo",produces = "application/json;charset=utf-8")
    public AjaxResult deleteArticleInfo(@RequestParam Long id)
    {
        return permissionService.deleteArticleInfo(id);
    }



    /*
     * @==============History===============<br/>;
     * @Description //   用户发表行程
     * @Date 2025/3/14
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    @PermissionAnnotate(operateType = "用户模块", operateExplain = "用户发表行程", sourceType = "controller")
    @PostMapping(value = "/insertTripInfo",produces = "application/json;charset=utf-8")
    public AjaxResult insertTripInfo(@RequestBody TripInfo tripInfo)
    {
        return permissionService.insertTripInfo(tripInfo);
    }


    /*
     * @==============History===============<br/>;
     * @Description //   用户更新行程
     * @Date 2025/3/18
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    @PermissionAnnotate(operateType = "用户模块", operateExplain = "用户更新行程", sourceType = "controller")
    @PostMapping(value = "/updateTripInfo",produces = "application/json;charset=utf-8")
    public AjaxResult updateTripInfo(@RequestBody TripInfo tripInfo)
    {
        return permissionService.updateTripInfo(tripInfo);
    }


    /*
     * @==============History===============<br/>;
     * @Description //   用户删除行程
     * @Date 2025/3/20
     * @Author < a href="chencheng@prmt.net">chen</ a>;
     */
    @PermissionAnnotate(operateType = "用户模块", operateExplain = "用户删除行程", sourceType = "controller")
    @DeleteMapping(value = "/deleteTripInfo",produces = "application/json;charset=utf-8")
    public AjaxResult deleteTripInfo(@RequestParam Long id)
    {
        return permissionService.deleteTripInfo(id);
    }


}
